package com.TwinBlade.PicturePassword;

import android.app.Activity;
import android.content.Intent;
import android.content.res.AssetManager;
import android.os.Bundle;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;

public class Root extends Activity
{
  private void a(InputStream paramInputStream, OutputStream paramOutputStream)
  {
    byte[] arrayOfByte = new byte[1024];
    while (true)
    {
      int i = paramInputStream.read(arrayOfByte);
      if (i == -1)
        return;
      paramOutputStream.write(arrayOfByte, 0, i);
    }
  }

  private void a(String paramString)
  {
    InputStream localInputStream = getAssets().open(paramString);
    FileOutputStream localFileOutputStream = openFileOutput(paramString, 0);
    a(localInputStream, localFileOutputStream);
    localInputStream.close();
    localFileOutputStream.flush();
    localFileOutputStream.close();
  }

  private void b(String paramString)
  {
    OutputStreamWriter localOutputStreamWriter = new OutputStreamWriter(Runtime.getRuntime().exec("su").getOutputStream());
    localOutputStreamWriter.write(paramString);
    localOutputStreamWriter.flush();
    localOutputStreamWriter.close();
    if (localOutputStreamWriter != null)
      localOutputStreamWriter.close();
  }

  public void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    Bundle localBundle = getIntent().getExtras();
    if (localBundle != null);
    while (true)
    {
      try
      {
        if (localBundle.getBoolean("Install"))
        {
          a("RH.apk");
          a("roothelper.sh");
          b("/system/bin/sh /data/data/com.TwinBlade.PicturePassword/files/roothelper.sh");
          setResult(-1);
          finish();
          return;
        }
        a("remove.sh");
        b("/system/bin/sh /data/data/com.TwinBlade.PicturePassword/files/remove.sh");
        continue;
      }
      catch (Exception localException)
      {
        setResult(0);
        continue;
      }
      setResult(0);
    }
  }
}

/* Location:           D:\Studium\Bachelorarbeit\BA Marcus Wobig\BA\BA\Decompiler\PicturePassword APK\Programm\PicturePassword_dex2jar.jar
 * Qualified Name:     com.TwinBlade.PicturePassword.Root
 * JD-Core Version:    0.6.2
 */